package org.zjx.resource;

import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;

// 新增密钥包装类
public class SecretKeyWrapper {
    private String algorithm;
    private byte[] encoded;
    private String format;

    public SecretKeyWrapper() {}

    public SecretKeyWrapper(SecretKey key) {
        this.algorithm = key.getAlgorithm();
        this.encoded = key.getEncoded();
        this.format = key.getFormat();
    }

    public SecretKey toSecretKey() {
        return new SecretKeySpec(encoded, algorithm);
    }
}